<!-- 整车/散货 选择 -->
<template>
    <view class="whole-select">
        <picker @change="bindPickerChange" :value="index" :range="CargoList" range-key="name">
            <view class="u-flex u-flex-center">
                <view class="uni-input">{{ text }}</view>
                <image style="width: 32rpx;height: 32rpx;margin-left: 16rpx;" src="@/static/index2/index14.png" mode="">
                </image>
            </view>
        </picker>
    </view>
</template>
<script>
export default {
    props: ['text'],
    data () {
        return {
            index: 0,
            CargoList: [],
        }
    },
    mounted () {
        this.handeleSheetList()
    },
    methods: {
        // 获取整车散货
        handeleSheetList () {
            let data = {
                type: "whole_diffuse"
            }
            this.$u.api.basic.getActionSheetList(data).then(res => {
                this.CargoList = res
            })
        },
        bindPickerChange (e) {
            this.index = e.target.value;
            this.$emit('change', this.CargoList[this.index].id);
        }
    }
}
</script>

<style lang="less" scoped>
.whole-select {
    width: 100%;
    height: 100%;

    .uni-input {
        color: #999999;
    }
}
</style>
